--[[--------------------------------------------------
ROCheck.lua
Authors: Midas, VladVRO
Version: 1.1.1
------------------------------------------------------
Script to automatically install the R / O mode for files with selectable attributes RHS
------------------------------------------------------
connection
  Add the SciTEStartup.lua line
    dofile (props["SciteDefaultHome"].."\\tools\\ROCheck.lua")
--]]--------------------------------------------------

local function ROCheck()
	-- Obtain the file attributes
	local FileAttr = props['FileAttr']
-- If among the attributes ReadOnly / Hidden / System, and is not set to R / O
	if string.find(FileAttr, "[RHS]") and not editor.ReadOnly then
	-- then set the mode
		scite.MenuCommand(IDM_READONLY)
	end
end

-- Add your event handler OnOpen
AddEventHandler("OnOpen", ROCheck)
